import {defineStore} from "pinia";

// 创建store defineStore('名字', {state: 状态, getters: 对state进行过滤或者筛选, actions: 定义对state状态如何修改的方法})
// 访问store 获取useCountStore const store = useCountStore()  store.count  store.getCount
export const useCountStore = defineStore('counter', {
	state: () => {
		return {
			count: 1
		}
	},
	getters: {
		getCount(state) {
			return state.count > 2 ? state.count : 2
		}
	},
	actions: {
		increment(n) {
			this.count += n
		}
	}
})